package cn.com.pkas.bean
{
	import cn.com.pkas.comm.Const;
	
	import com.adobe.serialization.json.JSON;
	
	public class Body
	{
		public function Body(_bodyLength:String,_bodyEncr:String,_bodyType:String,_bodySource:String,_blank:String,_body:String)
		{
			this._bodyLength = _bodyLength;
			this._bodyEncr = _bodyEncr;
			this._bodyType = _bodyType;
			this._bodySource = _bodySource;
			this._blank = _blank;
			this._body = _body;
		}
		/**报文长度**/
		private var _bodyLength:String;
		/**报文正文**/
		private var _body:String;
		/**报文MD5密文**/
		private var _bodyEncr:String;
		/**报文类型**/
		private var _bodyType:String;
		/**报文来源**/
		private var _bodySource:String;
		/**补齐位**/
		private var _blank:String;
		
		/**将body解析成对象，活动root对象**/
		private var _ROOT:Object;
		/**root中的返回码**/
		private var _hostRetCode:String;
		/**root中的返回信息**/
		private var _hostMessage:String;
		
		public function get blank():String{
			return this._blank;
		}
		
		public function set blank(blank:String):void{
			this._blank = blank;
		} 
		
		public function get bodyLength():String{
			return this._bodyLength;
		}
		
		public function set bodyLength(bodyLength:String):void{
			this._bodyLength = bodyLength;
		}

		public function get body():String{
			return this._body;
		}
		
		public function set body(body:String):void{
			this._body = body;
		}

		public function get bodyEncr():String{
			return this._bodyEncr;
		}
		
		public function set bodyEncr(bodyEncr:String):void{
			this._bodyEncr = bodyEncr;
		}
		
		public function get ROOT():Object{
			return JSON.decode(this._body)["ROOT"];
		}
		
		public function set ROOT(ROOT:Object):void{
			this._ROOT = ROOT;
		}
		
		public function get hostRetCode():String{
			return this.ROOT[Const.HOSTRETCODE];
//			return JSON.decode(this._body).root.hostRetCode;
		}
		
		public function set hostRetCode(hostRetCode:String):void{
			this._hostRetCode = hostRetCode;
		}
		
		public function get hostMessage():String{
			return this.ROOT[Const.HOSTMESSAGE];
//			return JSON.decode(this._body).root.hostMessage;
		}
		
		public function set hostMessage(hostMessage:String):void{
			this._hostMessage = hostMessage;
		}
		
		public function get bodySource():String{
			return this._bodySource;
		}
		
		public function set bodySource(bodySource:String):void{
			this._bodySource = bodySource;
		}

		public function get bodyType():String{
			return this._bodyType;
		}
		
		public function set bodyType(bodyType:String):void{
			this._bodyType = bodyType;
		}
	}
}